package cn.edu.swu.datanalysis.utils;

import java.io.IOException;
import java.io.InputStream;

public class DataExport {

	public static InputStream exportData(String dbName,String colName,String type,String fields){
		dbName = "mydb";
		colName = "mycol";
		type = "csv";
		fields = "a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,quality";
		String cmd = "mongoexport -d "+dbName+" -c "+colName+" --type="+type+" -f "+fields;
		
		try {
			Process pro = Runtime.getRuntime().exec(cmd);
			return pro.getInputStream();			
		} catch (IOException e) {}
		
		return null;
		
	}
}
